<!DOCTYPE HTML>
<html>
<head>
<title>图书馆后台管理平台</title>
<!-- Custom Theme files -->
<link href="/carfee/login/css/style.css" rel="stylesheet" type="text/css" media="all"/>
<!-- Custom Theme files -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<meta name="keywords" content="Login form web template, Sign up Web Templates, Flat Web Templates, Login signup Responsive web template, Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />

<link rel="shortcut icon" href="/carfee/favicon.ico"/>
<link rel="bookmark" href="/carfee/favicon.ico"/>

</head>
<body>
<div class="login">
	<h2>图书馆后台管理平台</h2>
	<div class="login-bottom">
		<div style="text-align:left;font-size:12px;color:#fff;position:relative">
			<span id="systime">系统时间</span>
			<div style="position:absolute;right:0;top:0">抚顺市图书馆欢迎您！</div>
		</div>
		<!-- 
		<h3>新用户 &nbsp;<a href="#">注册</a></h3>
		 -->
	</div>
	<div class="login-top">
		<h1></h1>
		<form>
			<div style="position: relative; height: 64px">
				<label style="padding-right:10px;color:#555;line-height:50px">帐号</label>
				<div style="position: absolute; top:0;left: 40px;right: 0;">
					<input type="text" id="name" value="" style="width:100%">
				</div>
			</div>
			<div style="position: relative; height: 64px;line-height:50px">
				<label style="padding-right:10px;color:#555">密码</label>
				<div style="position: absolute; top:0;left: 40px;right: 0;">
					<input type="password" id="pwd" value="" style="width:100%">
				</div>
			</div>
			
	    </form>
	    <div class="forgot" style="text-align:left;position:relative;padding:0 20px">
	    	<input type="submit" id="submit" value="登录" >
	    	<input type="button" id="cancel" value="取消" style="position:absolute;right:-20px;top:0;margin-right:0">
	    </div>
	</div>
</div>	
<div class="copyright">
	<p>Copyright &copy; 抚顺市图书馆版权所有<a target="_blank" href="#"></a></p>
</div>


</body>

<script type="text/javascript" src="/carfee/plugin/jquery/jquery-1.11.0.min.js"></script>

<script>
$(document).ready(function ()
{
	login_getDate();
	
	$("#name").focus();
	
	$("#pwd").val("");
	
	$("#submit").click(function (){
		var self = this;
		if ($(self).val() == "登陆中...")
		{
			return false;
		}
		$(self).val("登陆中...");
		$(self).css("background" ,"#818181");
		var obj = new Object();
		obj.loginName = $("#name").val();
		obj.loginPassword = $("#pwd").val();
		$.ajax({
			type: "POST",
			url: "/user/login.do",
			data: {loginName:$("#name").val(), loginPassword:$("#pwd").val()},
			dataType: "json",
			success :function(data)
			{
				if (data.flag == 1)
				{
					window.location.href="/carfee/index.html";
				}else{
					alert(data.returnMessage);
					$(self).val("登陆");
					$(self).css("background" ,"#f45b4b");
				}
			},
			error :function(){
				alert("登陆失败");
				$(self).val("登陆");
				$(self).css("background" ,"#f45b4b");
			}
		});
		
	});
	
	$(document).keydown(function(event){
	    if(event.keyCode==13){
	       $("#submit").click();
	    }
    });
});

//获取系统时间，将时间以指定格式显示到页面。  
function systemTime()  
{  
    //获取系统时间。  
    var dateTime=new Date();  
    var hh=dateTime.getHours();  
    var mm=dateTime.getMinutes();  
    var ss=dateTime.getSeconds();  
      
    //分秒时间是一位数字，在数字前补0。  
    mm = extra(mm);  
    ss = extra(ss);  
      
    $("#systime").text(hh+":"+mm+":"+ss);
    
    //每隔1000ms执行方法systemTime()。  
    setTimeout("systemTime()",1000);  
}

//补位函数。  
function extra(x)  
{  
    //如果传入数字小于10，数字前补一位0。  
    if(x < 10)  
    {  
        return "0" + x;  
    }  
    else  
    {  
        return x;  
    }  
}

function login_getDate(){
	var week; 
	var date = new Date();
	if(date.getDay()==0)          week="星期日" 
	if(date.getDay()==1)          week="星期一" 
	if(date.getDay()==2)          week="星期二" 
	if(date.getDay()==3)          week="星期三" 
	if(date.getDay()==4)          week="星期四" 
	if(date.getDay()==5)          week="星期五" 
	if(date.getDay()==6)          week="星期六"
	
	$("#systime").text(date.getFullYear()+"年"+(date.getMonth() + 1)+"月"+date.getDate()+"号 " + week);
}
</script>

</html>